/* eslint-disable no-unused-vars */
/* eslint-disable import/no-dynamic-require */
/* eslint-disable import/no-extraneous-dependencies */
const path = require('path');
const ModuleFederationPlugin = require('webpack/lib/container/ModuleFederationPlugin');
const CopyPlugin = require('copy-webpack-plugin');

const draw = 'node_modules/@jkyu/monet-draw-react/build';

const cfg = require(path.join(path.resolve('./'), 'config'));
module.exports = {
  custom: {
    resolve: {
      alias: {
        '@': path.resolve(__dirname, './src'),
        src: path.resolve(__dirname, './src'),
      }
    },
    plugins: [
      new CopyPlugin(
        [
          {
            from: path.join(draw, 'static'),
            to: 'static'
          }
        ],
      )
    ]
  },
  override: (config) => {
    config.output.publicPath = 'auto';
    config.plugins.push(
      new ModuleFederationPlugin({ ...cfg.EMP })
    );
    return config;
  }
};
